package com.winit.deploy.task.tomcatTask;

import com.winit.core.task.Task;
import com.winit.deploy.server.WinitTomcatServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by wangjian on 16/8/10.
 * 回滚
 */
public class DeployRollBackTask extends Task {

    static final Logger logger = LoggerFactory.getLogger(DeployRollBackTask.class);

    public WinitTomcatServer winitTomcatServer;

    public DeployRollBackTask(String taskId, Integer expireTime, WinitTomcatServer winitTomcatServer){
        super(taskId, expireTime);
        this.winitTomcatServer = winitTomcatServer;
    }

    @Override
    public TaskStatus call() throws Exception {
        logger.info("com.winit.deploy.task.tomcatTask.DeployRollBackTask.call start taskId="+this.taskId);
        this.winitTomcatServer.doRollBack();
        logger.info("com.winit.deploy.task.tomcatTask.DeployRollBackTask.call end taskId="+this.taskId);
        return TaskStatus.STATUS_SUCCESS;
    }
}
